#ifndef AUDIO_PROCESS_H
#define AUDIO_PROCESS_H

#include <stdint.h>
#include <stdlib.h>
#include <string.h>

#include <audio_agc.h>
#include <audio_ns.h>
#include <audio_aec.h>
#include <audio_hpf.h>

/*function type*
 * strFunname :function name
 * pFun:save value of function pointer
 */
typedef struct {
	char *strFunName;
	void **pFun;
}FUN_TYPE;

typedef struct {
	char ai_en;
	char ao_en;
	//char dmic_en;
} audio_dev_info_t;

/*define audioProcess funtion name*/
/*agc*/
#define FUN_AGC_CREATE_NAME "audio_process_agc_create"
#define FUN_AGC_SET_CONFIG_NAME "audio_process_agc_set_config"
#define FUN_AGC_GET_CONFIG_NAME "audio_process_agc_get_config"
#define	FUN_AGC_PROCESS_NAME "audio_process_agc_process"
#define FUN_AGC_FREE_NAME "audio_process_agc_free"
#define LIB_AUDIOPROCESS_AGC_FILE_NAME "libagc.so"
/*ns*/
#define FUN_NS_CREATE_NAME "audio_process_ns_create"
#define FUN_NS_SET_CONFIG_NAME "audio_process_ns_set_config"
#define FUN_NS_GET_CONFIG_NAME "audio_process_ns_get_config"
#define FUN_NS_PROCESS_NAME "audio_process_ns_process"
#define FUN_NS_FREE_NAME "audio_process_ns_free"
#define LIB_AUDIOPROCESS_NS_FILE_NAME "libns.so"
/*aec*/
#define FUN_AEC_CREATE_NAME "audio_process_aec_create"
#define FUN_AEC_PROCESS_NAME "audio_process_aec_process"
#define FUN_AEC_FREE_NAME "audio_process_aec_free"

/*hpf*/
#define FUN_HPF_CREATE_NAME "audio_process_hpf_create"
#define FUN_HPF_PROCESS_NAME "audio_process_hpf_process"
#define FUN_HPF_FREE_NAME "audio_process_hpf_free"
#define LIB_AUDIOPROCESS_HPF_FILE_NAME "libhpf.so"
/*hs*/
#define FUN_HS_CREATE_NAME "audio_process_hs_create"
#define FUN_HS_PROCESS_NAME "audio_process_hs_process"
#define FUN_HS_FREE_NAME "audio_process_hs_free"
#define LIB_AUDIOPROCESS_HS_FILE_NAME "libhs.so"
/*libaudioprocess.so path*/
#define LIB_AUDIOPROCESS_FILE_PATH "./libaudioProcess.so"
#define LIB_AUDIOPROCESS_FILE_IN_LIB "/lib/libaudioProcess"
#define LIB_AUDIOPROCESS_FILE_IN_USRLIB "/usr/lib/libaudioProcess.so"
#define LIB_AUDIOPROCESS_AEC_FILE_NAME "libaudioProcess.so"

/*audioProcess funtion pointer*/
/*Agc function*/
typedef void* (*pFun_agc_create)();
typedef int (*pFun_agc_set_config)(void*,int32_t,int32_t,int32_t,int,AgcConfig);
typedef void (*pFun_agc_get_config)(void*,AgcConfig*);
typedef int (*pFun_agc_process)(void*,const int16_t* const*,size_t,size_t,int16_t* const*,int32_t,int32_t*,int16_t,uint8_t*);
typedef void (*pFun_agc_free)(void*);

/*Ns function*/
typedef NsHandle* (*pFun_ns_create)();
typedef int (*pFun_ns_set_config)(NsHandle*,int,int);
typedef void (*pFun_ns_get_config)();
typedef void (*pFun_ns_process)(NsHandle*,const float* const*, int ,float* const* );
typedef void (*pFun_ns_free)(NsHandle*);

 /*Aec function pointer*/
typedef void* (*pFun_aec_create)(int, char *);
typedef int (*pFun_aec_process)(void *, struct aec_process_param *);
typedef int (*pFun_aec_free)(void *);

/*Hpf function pointer*/
typedef void (*pFun_hpf_create)(int16_t*,int16_t*,int16_t,int16_t,int,int);
typedef int (*pFun_hpf_process)(void*,short*,int);
typedef void (*pFun_hpf_free)();

/*Hs function pointer*/
typedef void* (*pFun_hs_create)();
typedef int (*pFun_hs_process)(void*, int16_t*, int16_t*, int);
typedef void (*pFun_hs_free)();

/*load libaudioProcess function as follows*/
/*load audio process library*/
extern void* load_audioProcess_library(const char* defaultDir[],int num,const char *libFileName,const char *env);

/*get funtion address from library*/
extern int get_fun_address(void *handle,FUN_TYPE funArr[],int num);

/*unload shared library*/
extern int free_audioProcess_library(void *handle);

#endif
